<jsp:useBean id="data" class="JEE2.Bean" scope="session"></jsp:useBean>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="JEE2.Login"%>

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Page </title>



</head>
<body onload="get()">
<div style="height: 75vh; width: 100%; text-align:center;">
    <%
        Cookie[] cookies = request.getCookies();
        data.setUserName(null);
        data.setUserPsd(null);
        for (Cookie cookie : cookies) {
            if (cookie.getName().equals("name")){
                data.setUserName(cookie.getValue());
                data.setCheckd("true");
            }

            if (cookie.getName().equals("psd"))
                data.setUserPsd(cookie.getValue());
        }
    %>

    <script>
        function get() {
            var temp = "<%=data.getUserName()%>"
            if(temp != "null")
                document.getElementById('box').checked = true;
            else
                document
        }
    </script>

    <form action="JEE2.Login" method="get">
        Account &nbsp;
        <input type="text" name="name" id="name" value=${data.userName}>
        PassWord &nbsp;
        <input type="password" name="psd" id="psd" value=${data.userPsd}>
        <br>
        Keep &nbsp;
        <input type="checkbox" name="box" id="box">
        <br><br>
        <button type="submit">Submit</button> &nbsp;&nbsp;
        <button type="reset">Reset</button>
    </form>
    <form action="JEE2.SignUp" method="get">
        Account &nbsp;
        <input type="text" name="name" id="signName" >
        PassWord &nbsp;
        <input type="text" name="psd" id="SignPsd" >
        <br>
        <button type="submit">Sign Up</button>
    </form>
    <br>
</div>
</body>
</html>